<template>
  <view class="task-item">
    <view class="content">
      <text class="title">{{ title }}</text>
      <text class="time">{{ time }}</text>
    </view>
    <view class="priority" :class="priorityClass">
      <text>{{ priority }}</text>
    </view>
  </view>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      required: true
    },
    time: {
      type: String,
      required: true
    },
    priority: {
      type: String,
      required: true,
      validator: (value) => ['高', '中', '低'].includes(value)
    }
  },
  computed: {
    priorityClass() {
      return {
        high: this.priority === '高',
        medium: this.priority === '中', 
        low: this.priority === '低'
      }
    }
  }
}
</script>

<style scoped lang="scss">
.task-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: 1px solid rgba(100,181,246,0.1);
  
  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 1);
  }

  &:active {
    transform: scale(0.98);
  }

  .content {
    flex: 1;
    margin-right: 16px;

    .title {
      display: block;
      font-size: 16px;
      font-weight: 500;
      color: #1a1a1a;
      margin-bottom: 6px;
      transition: color 0.2s ease;
    }

    .time {
      display: block;
      font-size: 14px;
      color: #8E8E93;
      font-weight: 400;
    }
  }

  .priority {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;

    &.high {
      background: linear-gradient(145deg, #FF3B30 0%, #FF6A5C 100%);
    }

    &.medium {
      background: linear-gradient(145deg, #FF9500 0%, #FFB74D 100%);
    }

    &.low {
      background: linear-gradient(145deg, #34C759 0%, #4CD964 100%);
    }
  }

  &.completed {
    opacity: 0.6;
    .title {
      text-decoration: line-through;
      color: #8E8E93;
    }
    .priority {
      opacity: 0.7;
      transform: scale(0.9);
    }
  }
}
</style>
